<?php

namespace App\Admin\Renderable;

use Dcat\Admin\Support\LazyRenderable;
use Dcat\Admin\Widgets\Table;

class FarmerImgs extends LazyRenderable
{
    public function render()
    {
        $dataInfo = $this->payload['imgs'];
        $dataInfo = json_decode($dataInfo, true);
        $img_html_str = '';
        foreach ($dataInfo as $dataInfoVal) {
            if ($dataInfoVal) {
                $img_html_str .= "<img data-action='preview-img' src='".config('app.url').'/uploads/'.$dataInfoVal."' style='max-height:60px;cursor:pointer' class='img img-thumbnail' />";
            }

        }
        $imgData = [[$img_html_str]];

        return Table::make([], $imgData);
    }
}